import { createI18n } from 'vue-i18n'
import zh_CN from './zh-CN.json'
import en_US from './en-US.json'


const localeLanguage = navigator.language || 'zh-CN'
const i18n = createI18n({
  legacy: false,
  globalInjection:true,
  locale: (localStorage.getItem('lang') || localeLanguage.split('-')[0] || 'ZH').toLocaleUpperCase(),
  fallbackLocale: "zh",
  messages: {
    ZH: zh_CN,
    EN: en_US,
  }
})

export default i18n